package com.example.xpvideo.Controller;

import com.example.xpvideo.entity.PageResult1;
import com.example.xpvideo.entity.ResponseResult;
import com.example.xpvideo.entity.req.LocalMerchantsReq;
import com.example.xpvideo.entity.req.SupplierMerchantReq;
import com.example.xpvideo.entity.req.UpdateBusinessReq;
import com.example.xpvideo.entity.res.PhpLocalMerchantsRes;
import com.example.xpvideo.entity.res.PHPLocalMerchantsDetail;
import com.example.xpvideo.entity.res.PHPMerchantsDetailRes;
import com.example.xpvideo.entity.res.PhpMerchantsRes;
import com.example.xpvideo.service.PhpLocalMerchnatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import javax.xml.ws.Action;
import java.util.List;

/**
 * @author : 洪俊新
 * @date : 2021/8/24 16:17
 * @description:
 */
@RestController
@RequestMapping("/back/phplocalmerchants")
public class PhpLocalMerchantsController {
    @Autowired
    private PhpLocalMerchnatsService phpLocalMerchnatsService;

    /**
     * 供应商城商户列表
     * */
    @GetMapping("/list")
    public ResponseResult<PageResult1<List<PhpLocalMerchantsRes>>> list(LocalMerchantsReq localMerchantsReq)
            throws Exception{
        return phpLocalMerchnatsService.list(localMerchantsReq);
    }
    /**
     * 供应商城商户列表详情
     * */
    @GetMapping("/detail")
    public ResponseResult<PHPLocalMerchantsDetail> detail(@NotNull Integer id) throws Exception{
        return phpLocalMerchnatsService.detail(id);
    }

    @PostMapping("/updatebusiness")
    public ResponseResult<Object> updateBusiness(@NotNull
                                                 @RequestBody UpdateBusinessReq updateBusinessReq) throws Exception{
        return phpLocalMerchnatsService.updateBusiness(updateBusinessReq);
    }
}
